<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            height: 200px;
            width: 200px;
            position: absolute;
        }
        /* z-index谁大谁在上面，但是要求二者都有定位 */
        .box1 {
            background-color: aqua;

            left: 50px;
            top: 50px;

            z-index: 2;
        }

        .box2 {
            background-color: rebeccapurple;
            z-index: 3;
        }
    </style>
</head>

<body>
    <div class="box box1"></div>
    <div class="box box2"></div>
</body>

</html>